package org.springblade.task;

import org.springblade.modules.develop.entity.SystemData;
import org.springblade.modules.develop.mapper.SystemDataMapper;
import org.springblade.modules.develop.service.ISystemDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 分销商相关定时任务
 *
 * @description:
 * @author: lsw
 * @date: 2020-05-19 11:35
 **/
@Component
@Configuration
@EnableScheduling
public class DistributorTask {
	@Autowired
	private SystemDataMapper systemDataMapper;

	String[] str = {"生命关怀","自然生态","科技创新","生活感悟","历史底蕴","文化艺术感受"};
	String[] str2 = {"理想","哲学","信仰","景物描写","借景抒情","生态关注"};

//    @Scheduled(cron = "0 0/1 * * * ?")
    public void createDistributorStatement1() {
		int index = 0;
    	for(int i = 0; i < 100000; i++) {
			SystemData systemData = new SystemData();
			systemData.setName(str[index]);
			systemData.setPath("QUESTION_TITLE_LIFE_CARE" + i);
			systemData.setDataKey("智慧");
			systemDataMapper.insert(systemData);
			index++;
			if(index >= 6) {
				index = 0;
			}
		}
    }


//	@Scheduled(cron = "0 0/1 * * * ?")
	public void createDistributorStatement2() {
		int index2 = 0;
		for(int i = 0; i < 100000; i++) {
			SystemData systemData = new SystemData();
			systemData.setName(str[index2]);
			systemData.setPath("QUESTION_TITLE_LIFE_CARE" + i);
			systemData.setDataKey(str2[index2]);
			systemData.setDataValue(index2 + "");
			systemDataMapper.insert(systemData);
			index2++;
			if(index2 >= 6) {
				index2 = 0;
			}
		}
	}


}
